<template>
  <div>
    <el-berad></el-berad>
    <el-button type="primary" size="medium" @click="add">添加</el-button>
    <g-list @edit="edit"></g-list>
    <g-dialog
      :dialogInfo="dialogInfo"
      @cancel="cancel"
      ref="goodsInfo"
    ></g-dialog>
  </div>
</template>

<script>
import gDialog from "./dialog";
import gList from "./list";
export default {
  data() {
    return {
      dialogInfo: {
        isShow: false,
        isAdd: true,
      },
    };
  },
  components: {
    gDialog,
    gList,
  },
  methods: {
    add() {
      this.dialogInfo.isShow = true;
      this.dialogInfo.isAdd = true;
    },
    cancel(e) {
      this.dialogInfo.isShow = e;
    },
    edit(e) {
      this.dialogInfo.isShow = true;
      this.dialogInfo.isAdd = false;
      this.$refs.goodsInfo.lookup(e);
    },
  },
};
</script>

<style lang="" scoped>
.el-button {
  margin: 20px 0;
}
</style>
